package com.miaoji.controller;

import com.miaoji.domain.po.UserInfo;
import com.miaoji.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import com.alibaba.fastjson.JSON;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class UserCenterController {
    @Autowired
    UserService userService;
    @PostMapping("/login")
    public String login(@RequestBody UserInfo userInfo){
        //System.out.println(userInfo);
        //return null;
        return JSON.toJSONString(userService.UserLogin(userInfo));

    }
    @PostMapping("api/user-select")
    public String userSelect(){
        //userService.UserSelect();
        return userService.UserSelect();
    }

    @PostMapping("api/user-update")
    public void userUpdate(@RequestBody UserInfo userInfo){
        userService.UserUpdateState(userInfo.getId(),userInfo.getState());
    }
}
